﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Collections;

namespace LabaCS4
{
    [Serializable]

    public class Chapter
    {
        public string chapters;
        public Chapter(string chapter)
        {
            chapters = chapter;
        }
    }

    [Serializable]

    public class Book : IEnumerable
    {
        public string title, author, cost;
        public Bitmap photo;
        private ArrayList chapterList;
        public Book()
        {
            chapterList = new ArrayList();
        }
        public Book(string title, string author,string cost)
           
        {

            chapterList = new ArrayList();
            this.title = title;
            this.author = author;
            this.cost = cost;
        }
       
        public Book(string title, string author, string cost, Bitmap photo)
        {
            chapterList = new ArrayList();
            this.title = title;
            this.author = author;
            this.cost = cost;
            this.photo = photo;
        }
        public IEnumerator GetEnumerator()
        {
            return chapterList.GetEnumerator();
        }
        
        public void AddChapter(Chapter c)
        {
            chapterList.Add(c);

        }
        public void RemoveChaprer(int chapterToRemove)
        {
            chapterList.RemoveAt(chapterToRemove);

        }

        public int ChapterCount
        {
            get { return chapterList.Count; }
        }
        public bool ChapterIsPresent(Chapter c)
        {
            return chapterList.Contains(c);

        }


    }
}
